<div class="header-wrap">
  {* 首页 *}
  {if $nav_type == 'index'}
    <div class="header clearfix">
      <a class="head-edit js_topDropBtn" href="javascript:void(0);"></a>
      <h1 class="logo"><a href="{AnUrl('')}"><img src="{$smarty.const.STATIC_URL}/images/m2-images/logo.png" width="52" height="51"></a></h1>
      <a class="head-buy-car js_topCartBtn" href="{AnUrl('cart')}">
        {if cart_helper::get_cart_num() > 0}<em></em>{/if}
      </a>
      <a class="head-user js_topUserBtn" href="{if user_helper::get_user_id()}{AnUrl('user/setting')}{else}{AnUrl('user/login')}{/if}"></a>
    </div>
    <div class="header-drop js_topDropbox">
      <div class="search-bar clearfix">
        <span class="txt"><input type="text" value="" class="js_sTopIpt"></span>
        <a href="javascript:void(0);" class="btn js_sTopBtn"></a>
      </div>
      <div class="h-nav">
        <ul>
          <li class="clearfix"><a href="{AnUrl('')}"><i class="icon7"></i>商城首页</a></li>
          <li class="clearfix"><a href="{AnUrl('topic/m100')}"><i class="icon3"></i>{topic_config::$topic_list['m100']}<em class="arrow"></em></a></li>
          {* <li class="clearfix"><a href="{AnUrl('topic/newglass')}"><i class="icon4"></i>{topic_config::$topic_list['newglass']}<em class="arrow"></em></a></li> *}
          <li class="clearfix"><a href="{AnUrl('events/newglass')}"><i class="icon4"></i>{topic_config::$topic_list['newglass']}<em class="arrow"></em></a></li>
          <li class="clearfix"><a href="{AnUrl('topic/d600')}"><i class="icon2"></i>{topic_config::$topic_list['d600']}<em class="arrow"></em></a></li>
          <li class="clearfix"><a href="{AnUrl('goods/9')}"><i class="icon1"></i>{topic_config::$topic_list['x360']}<em class="arrow"></em></a></li>
          <li class="clearfix"><a href="{AnUrl('topic/x330')}"><i class="icon1"></i>{topic_config::$topic_list['x330']}<em class="arrow"></em></a></li>
          <li class="clearfix"><a href="{AnUrl('goods/10')}"><i class="icon1"></i>{topic_config::$topic_list['filter']}<em class="arrow"></em></a></li>
          <li class="clearfix"><a href="{AnUrl('topic/newifi')}"><i class="icon5"></i>{topic_config::$topic_list['newifi']}<em class="arrow"></em></a></li>
          <li class="clearfix"><a href="{AnUrl('topic/mengqibi')}"><i class="icon6"></i>{topic_config::$topic_list['mengqibi']}<em class="arrow"></em></a></li>
        </ul>
      </div>
    </div>
  {* 其他页面 *}
  {else}
    <div class="header clearfix">
      <a class="header-l" href="javascript:history.back();"></a>
      <h2>{if !$title}NBD官网-首页{else}{$title}{/if}</h2>
      <a class="header-r js_topDropBtn" href="javascript:void(0);"></a>
    </div>
    <div class="header-drop js_topDropbox">
      <div class="buy-car-drop">
        <ul class="clearfix">
          <li><a href="{AnUrl('')}" class="icon1"></a></li>
          <li><a href="{AnUrl('user/setting')}" class="icon2"></a></li>
          <li><a href="{AnUrl('cart')}" class="icon3">{if cart_helper::get_cart_num() > 0}<em></em>{/if}</a></li>
          <li><a href="{AnUrl('goods')}" class="icon4"></a></li>
        </ul>
      </div>
    </div>
  {/if}
</div>
<script>
  $(function(){
    // 首页下拉效果
    var dropEl = $('.js_topDropbox');
    var dropH  = dropEl.css({
      visibility: 'hidden',
      height: 'auto'
    }).height();
    dropEl.css({
      visibility: 'visible',
      height: '0px'
    });
    $('.js_topDropBtn').on('touchstart', function(e){
      e.stopPropagation();
      e.preventDefault();
      var tmpH = dropEl.height();
      if(tmpH == 0) {
        $('.js_shadeBlack').show();
        dropEl.height(dropH);
        $(this).addClass('head-edit-close');
      } else if(tmpH == dropH) {
        dropEl.height(0);
        $('.js_shadeBlack').hide();
        $(this).removeClass('head-edit-close');
      }
    });
    $('.shade-black').on('touchstart', function(e){
      e.preventDefault();
      e.stopPropagation();
      var wrLength = $(e.target).closest('.header-wrap').length;
      if((!wrLength || (wrLength && $(e.target).is('a')) && !$(e.target).closest('.js_topDropbox').length) && dropEl.height() > 0) {
        $('.js_topDropBtn').trigger('touchstart');
      }
    });

    // 搜索
    $('.js_sTopBtn').on('touchend', function(){
      var sTxt = $.trim($('.js_sTopIpt').val());
      // if(!sTxt) {
      //   mobileShowMsg("请输入要查询的关键词");
      //   $('.js_sTopIpt').focus();
      //   return;
      // }
      window.location.href = "{AnUrl('goods')}?goods_title="+sTxt;
    });
  });
</script>